package com.zhx.framework.util.result;

/**
 * @author zhanghaixuan
 * @create 2018/3/16-下午1:56
 **/
public class Result {

    private int code;

    private String msg;

    private Object data;

    public Result(){

    }

    public static Result OK(String msg){
        Result result = new Result();
        result.setMsg(msg);
        return result;
    }

    public static Result Error(int code,String message){
        Result result = new Result();
        result.setCode(code);
        result.setMsg(message);
        return result;
    }

    public static Result OK(String msg,Object data){
        Result result = new Result();
        result.setMsg(msg);
        result.setCode(0);
        result.setData(data);
        return result;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
